import Vue from "vue";
import CollapseTransition from "element-ui/lib/transitions/collapse-transition";
import selectGroup from "./unit/selectGroup";
import unitTable from "./unit/table";
import unitCards from "./unit/cards";
import pagination from "./unit/pagination";
import upload from "./unit/upload";
import treebox from "./unit/treebox";
import transtionWidth from "./unit/transtionWidth";
import inputNum from "./unit/inputNum";
import icon from "./icon";

Vue.component(CollapseTransition.name, CollapseTransition);
Vue.component("selectGroup", selectGroup);
Vue.component("unitTable", unitTable);
Vue.component("unitCards", unitCards);
Vue.component("pagination", pagination);
Vue.component("upload", upload);
Vue.component("treebox", treebox);
Vue.component("transtionWidth", transtionWidth);
Vue.component("inputNum", inputNum);
// icon
let icons = {};
icon.map(v => {
  icons[v] = resolve => require([`./icon/${v}.vue`], resolve);
});
Vue.component("unitIcon", {
  props: {
    color: {
      type: String,
      default: "#4d6ee8"
    },
    disabled: {
      type: Boolean,
      default: false
    },
    size: {
      type: [Number, String],
      default: 20
    },
    type: {
      type: String,
      default: ""
    }
  },
  components: {
    ...icons
  },
  template: `<svg t="1594783052294" class="icon" viewBox="0 0 1024 1024" version="1.1"
  xmlns="http://www.w3.org/2000/svg" :width="size" :height="size" :fill="disabled?'#c0c4cc':color" v-if="type">
  <component :is="type" />
  </svg>`
});
